﻿@model TraCuuThuatNgu.ViewModels.UsersViewModel
@{
    ViewBag.Title = "Quản lý thành viên";
    Layout = "~/Views/Shared/_Admin.cshtml";
}
@using PagedList.Mvc;
@using PagedList;
<style type="text/css">
    #Users
    {
        border-color: #143D6B;
        background: url("/Content/img/backgrounds/menu-item-active.jpg") left top repeat-x;
    }
</style>
<div class="row-fluid">
    <h2>
        Quản lý thành viên</h2>
    <div class="dr">
        <span></span>
    </div>
    <div class="span span12">
        <div class="block block-sumary">
            <div class="sumary">
                <form action="/Users" method="get">
                <label>
                    Tìm kiếm</label>
                <input name="keyword" type="text" style="margin-right: 5px;" /><input class="btn"
                    type="submit" value="Tìm" />
                </form>
            </div>
        </div>
    </div>
    <div class="span span12">
        <div class="head">
            <div class="icm-user">
            </div>
            <h1>
                Danh sách thành viên</h1>
            <div class="clear">
            </div>
        </div>
        <div class="block">
            <table cellpadding="0" cellspacing="0" width="100%" class="table">
                <thead>
                    <tr>
                        <th width="10%">
                            Tên đăng nhập
                        </th>
                        <th width="20%">
                            Họ tên
                        </th>
                        <th width="20%">
                            Email
                        </th>
                        <th width="20%">
                            Quyền
                        </th>
                        <th width="20%">
                            Ngày sinh
                        </th>
                        <th width="20%">
                            Đăng ký lúc
                        </th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var item in Model.Users)
                    {
                        <tr>
                            <td>
                                <a href="/Users/Detail?username=@item.UserName"><b>@item.UserName</b></a>
                            </td>
                            <td>
                                @item.Profile.Fullname
                            </td>
                            <td>
                                @item.aspnet_Membership.Email
                            </td>
                            <td>
                                @foreach (var role in item.aspnet_Roles)
                                {
                                    if (role.RoleName.Equals("Admin"))
                                    {
                                    <span style="color: Green; font-weight: bold; margin-right: 5px">@role.RoleName</span>
                                    }
                                    else
                                    { 
                                    <span style="color: #666; font-weight: bold; margin-right: 5px">@role.RoleName</span>
                                    }

                                }
                            </td>
                            <td>
                                @String.Format("{0:d/M/yyyy}", item.Profile.Birthday)
                            </td>
                            <td>
                                @String.Format("{0:d/M/yyyy HH:mm}", item.aspnet_Membership.CreateDate)
                            </td>
                        </tr>
                    }
                </tbody>
            </table>
            <div class="view-more">
                @Html.PagedListPager((IPagedList)Model.Users, page => Url.Action("Index", new { page = page, keyword = Request.QueryString["keyword"] }), new PagedListRenderOptions { LinkToFirstPageFormat = "<< Đầu tiên", LinkToPreviousPageFormat = "&larr; Trước", LinkToNextPageFormat = "Sau &rarr;", LinkToLastPageFormat = "&Uacute;Cuối >>" })</div>
            <div class="clear">
            </div>
        </div>
    </div>
</div>
